import {Injectable} from '@angular/core';
import {HttpUtilService} from "../../../../services/http/http-util.service";
import {environment} from "../../../../../environments/environment";
import {Observable} from "rxjs";

@Injectable({
  providedIn: 'root'
})
export class RoleMenuService {

  private prefix = environment.serverName.system + "/role-menu/"

  constructor(private http: HttpUtilService) {
  }

  /**
   * 添加
   * @param roleId
   * @param menuId
   * @param handleError
   */
  add(roleId: string, menuId: string, handleError = true): Observable<void> {
    return this.http.post(this.prefix + "add", {roleId, menuId}, handleError)
  }

  /**
   * 删除
   * @param roleId
   * @param menuId
   * @param handleError
   */
  delete(roleId: string, menuId: string, handleError = true): Observable<void> {
    return this.http.post(this.prefix + "delete", {roleId, menuId}, handleError)
  }
}
